/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.bridge;

import ru.jSky.factory.BridgeFactory;
import ru.jSky.factory.FinderByFormIdFactory;

/**
 *
 * @author Rakev
 */
public class JSkyBridge<E> {

    private E adapting;

    public JSkyBridge(E adapting) {
        this.adapting = adapting;
    }

    public E getAdapting() {
        return adapting;
    }

    protected BridgeFactory getBridgeFactory() {
        return new BridgeFactory();
    }

    protected FinderByFormIdFactory getFinderFactory() {
        return new FinderByFormIdFactory();
    }

    @Override
    public int hashCode() {
        return getAdapting().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        if (obj.getClass().equals(this.getClass())) {
            final JSkyBridge<E> other = (JSkyBridge<E>) obj;
            return getAdapting().equals(other.getAdapting());
        }
        return false;
    }

    @Override
    public String toString() {
        return getAdapting().toString();
    }
}
